package val.lemonde;

import android.os.Parcel;
import android.os.Parcelable;

public class Categorie implements Comparable<Categorie>, Parcelable {

	private String id;

	private String name;

	private int position;

	private boolean visible;

	private String url;

	public Categorie(String id) {
		this.id = id;
		this.name = "";
		this.url = "";
		this.position = 0;
		this.visible = false;
	}

	@Override
	public int compareTo(Categorie arg0) {
		return (this.id.compareTo(arg0.id));
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUrl() {
		return url;
	}

	public String getId() {
		return id;
	}

	public String toString() {
		return (this.name);
	}

	public static final Parcelable.Creator<Categorie> CREATOR = new Parcelable.Creator<Categorie>() {
		public Categorie createFromParcel(Parcel in) {
			return new Categorie(in);
		}

		public Categorie[] newArray(int size) {
			return new Categorie[size];
		}
	};

	private Categorie(Parcel in) {
		this.id = in.readString();
		this.name = in.readString();
		this.url = in.readString();
		this.position = in.readInt();
		this.visible = in.readByte() == 1; 
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int arg1) {
		out.writeString(this.id);
		out.writeString(this.name);
		out.writeString(this.url);
		out.writeInt(this.position);
		out.writeByte((byte) (this.visible  ? 1 : 0));
	}

}
